#ifndef _TUBOXFILE_H_
#define _TUBOXFILE_H_

#include "file.h"
#include "folder.h"
#include "filesystemerror.h"

#include <QString>
#include <QFileInfo>

namespace Tubox {

class Action;

class TuboxFile {

public:
	TuboxFile(const QString& absolutePath, const QString& path) throw(FileSystemError);

	QList<Action*> check() const;
	QList<Action*> update(QList<File> files, QList<Folder> folders) const;

	void add(const File& file) const throw(FileSystemError);
	void add(const Folder& folder) const throw(FileSystemError);

	void remove(const File& file) const throw(FileSystemError);
	void remove(const Folder& folder) const throw(FileSystemError);

private:
	QList<Action*> checkFiles() const;
	QList<Action*> checkFolders() const;
	QList<Action*> updateFiles(const QList<File> &files) const;
	QList<Action*> updateFolders(const QList<Folder> &folders) const;
	File lineToFile(const QString &line) const;
	Folder lineToFolder(const QString &line) const;

	QString absolutePath;
	QString path;
};

}

#endif // _TUBOXFILE_H_
